package com.itzhigui.utils;

import org.springframework.stereotype.Component;

/**
 * @Author: 张兴宇
 * @Description(描述): 生成验证码的工具类
 * @DateTime: 2023/11/11 18:34
 **/
@Component
public class VerifyCodeUtil {
    /**
     * 生成四位数字的验证码
     * @return
     */
    public  String genFourDigitCode(){
        StringBuilder sb = new StringBuilder("");
        for (int i = 0; i < 4; i++) {
            int number = (int) (Math.random()*10);
            sb.append(number);
        }
        return sb.toString();
    }
}
